﻿@model IEnumerable<MvcAtletIS.Models.Articles>
@{
    ViewBag.Title = "Archív článkov";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Archív článkov</h2>

<p> 
    Vyberte rok a mesiac, pre ktorý chcete zobraziť prehľad pretekov. 
</p>

@using (Html.BeginForm())
{   
    <div class="filter-frame">
        
        <div class="filter-item">
            <div class="editor-label">
                Rok
            </div>
            <div class="editor-field">
                @Html.DropDownList("selectedYear", null, "Vyberte rok", new { onchange = "this.form.submit();" })
            </div>
        </div>
    
        <div class="filter-item">
            <div class="editor-label">
                Mesiac
            </div>
            <div class="editor-field">
                @Html.DropDownList("selectedMonth", null, "Vyberte mesiac", new { onchange = "this.form.submit();" })
            </div>
        </div>

    </div>
}

@foreach (var item in Model)
{ 
    <div class="article">
        <div id="next-articles">
            @Html.DisplayFor(modelItem => item.Title)
        </div>
        
        <div class="article-image">
            <img src="@Url.Content("~/Content/articles/" + item.ImagePath)" alt="commonArticle.Name" width="300px" />
                
            @if (!string.IsNullOrEmpty(item.ImageText))
            {
                <p>
                    @Html.Raw(item.ImageText)
                </p>
            }
        </div>
        
        <p class="article-perex">
            @Html.DisplayFor(modelItem => item.Perex)
        </p>
        
        <p class="article-text">
            <b>
                @Html.DisplayFor(modelItem => item.City)
                @item.Date.Value.ToLongDateString()
                (@Html.DisplayFor(modelItem => item.Editor))
            </b>
            
            @Html.Raw(item.Text)
        </p>

    </div>
}